package com.pomr.util.communication.cx221;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSONObject;
import com.pomr.util.communication.Communication;
import com.pomr.util.communication.cx215.CX215Back;

/**
 * 
 * 类名称： CX221Back
 * 创建人： Administrator
 * 创建时间：2018年5月8日 下午3:17:13
 * 类描述：2.2.1 卡片状态变更接口 出参
 */
public class CX221Back implements Communication,Serializable{
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getCodeName() {
		return codeName;
	}

	public void setCodeName(String codeName) {
		this.codeName = codeName;
	}


	private int code;//变更状态 0=正常， 1=appid， secret， sign 有误， 2=iccid,imsi,msisdn 有误，3=主套餐到期， 4=流量超额， 5=状态编码错误， 9999=意外错误
	private String codeName;
	
	public static Object fromJson(String jsonStr) {
		jsonStr = "{'code':0}";
		CX221Back back = (CX221Back)JSONObject.parseObject(jsonStr, CX221Back.class);
		//查询状态
		if(back.getCode() == 0){
			back.setCodeName("变更正常");
		}else if(back.getCode() == 1){
			back.setCodeName("appid、secret、sign有误");
		}else if(back.getCode() == 2){
			back.setCodeName("imsi、iccid、msisdn有误");
		}else if(back.getCode() == 3){
			back.setCodeName("主套餐到期");
		}else if(back.getCode() == 4){
			back.setCodeName("流量超额");
		}else if(back.getCode() == 5){
			back.setCodeName("状态编码错误");
		}else if(back.getCode() == 9999){
			back.setCodeName("意外错误");
		}
		return back;
	}

}
